home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 1.iso / toolbox / src / tutorials / custEducation / opengl1 / examples / windows / window.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-11-11  |  1.4 KB  |  53 lines

  1. /*
  2.  * Copyright 1993, 1996, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17.  
  18. /*
  19.  *  window.c  - open a window in a specified position
  20.  */
  21.  
  22. #include <GL/gl.h>
  23. #include <GL/glut.h>
  24.  
  25. GLvoid drawScene( GLvoid );
  26.  
  27. void
  28. main( int argc, char *argv[] )
  29. {
  30.     GLsizei width, height;
  31.  
  32.     glutInit( &argc, argv );
  33.  
  34.     /* create a window that is 1/4 the size of the screen,
  35.      * and position it in the middle of the screen.
  36.      */
  37.     width = glutGet( GLUT_SCREEN_WIDTH ); 
  38.     height = glutGet( GLUT_SCREEN_HEIGHT );
  39.     glutInitWindowPosition( width / 4, height / 4 );
  40.     glutInitWindowSize( width / 2, height / 2 );
  41.     glutInitDisplayMode( GLUT_RGBA );
  42.     glutCreateWindow( argv[0] );
  43.  
  44.     glutDisplayFunc( drawScene );
  45.     glutMainLoop();
  46. }
  47.  
  48. GLvoid
  49. drawScene( GLvoid )
  50. {
  51.     /* You will do all of your OpenGL rendering here */
  52. }
  53.